home *** CD-ROM | disk | FTP | other *** search
Text File | 1997-04-13 | 1018 b | 54 lines | [TEXT/ttxt] |
- -- Part of SmallEiffel -- Read DISCLAIMER file -- Copyright (C)
- -- Dominique COLNET and Suzanne COLLIN -- colnet@loria.fr
- --
- class EXAMPLE
- --
- -- The Eiffel program is running first, then call the C program
- -- which is in charge to call the Eiffel feature `show_values'.
- --
- -- To compile this example, use command :
- --
- -- compile -cecil cecil.se example c_prog.c
- --
- -- Is is also possible to do :
- --
- -- gcc -c c_prog.o
- -- compile -cecil cecil.se example c_prog.o
- --
-
- creation make
-
- feature
-
- make is
- do
- values := <<1,2,3>>;
- call_c_prog(Current.to_pointer);
- end;
-
- show_values is
- local
- i: INTEGER;
- do
- from
- i := values.lower;
- until
- i > values.upper
- loop
- io.put_integer(values.item(i));
- io.put_new_line;
- i := i + 1;
- end;
- end;
-
- feature {NONE}
-
- values: ARRAY[INTEGER];
-
- call_c_prog(current_object: POINTER) is
- external "C"
- alias "c_prog"
- end;
-
- end -- EXAMPLE
-